// HintView.cpp : implementation file
//

#include "stdafx.h"
#include "assit.h"
#include "HintView.h"


// CHintView

IMPLEMENT_DYNCREATE(CHintView, CView)

CHintView::CHintView()
{

}

CHintView::~CHintView()
{
}

BEGIN_MESSAGE_MAP(CHintView, CView)
	ON_WM_ERASEBKGND()
	ON_WM_TIMER()
END_MESSAGE_MAP()


// CHintView drawing

void CHintView::OnDraw(CDC* pDC)
{
	CDocument* pDoc = GetDocument();
	// TODO: add draw code here
	if(m_hint.IsEmpty()) return;
	CRect rect;
	pDC->GetClipBox(&rect);
	pDC->SetTextColor(RGB(255, 0, 0));
	pDC->DrawText(CString(m_hint), rect, DT_CENTER);
}

void CALLBACK TimerCallback(HWND hwnd, UINT, UINT_PTR, DWORD)
{
	::ShowWindow(hwnd, SW_HIDE);
	KillTimer(hwnd, 2000);
}

void CHintView::setHint(CString hint)
{
	m_hint = hint;
	InvalidateRect(NULL);
	UpdateWindow();

	SetTimer( 1,  2000, TimerCallback);
}


// CHintView diagnostics

#ifdef _DEBUG
void CHintView::AssertValid() const
{
	CView::AssertValid();
}

#ifndef _WIN32_WCE
void CHintView::Dump(CDumpContext& dc) const
{
	CView::Dump(dc);
}
#endif
#endif //_DEBUG


// CHintView message handlers

BOOL CHintView::OnEraseBkgnd(CDC* pDC)
{
	// TODO: Add your message handler code here and/or call default
	pDC->SetBkMode(TRANSPARENT);
	//return CView::OnEraseBkgnd(pDC);
	return TRUE;
}


void CHintView::OnTimer(UINT_PTR nIDEvent)
{
	// TODO: Add your message handler code here and/or call default

	CView::OnTimer(nIDEvent);
}
